package com.cs.contract.controller;

import com.cs.contract.service.CsTenderService;
import com.cs.contract.domain.CsTender;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：zrx
 * @Package：com.cs.controller
 * @Project：RuoYi-Cloud
 * @name：CsTenderController
 * @Date：2024/11/20 11:12
 * @Filename：CsTenderController
 */
@RestController
@RequestMapping("/tender")
public class CsTenderController extends BaseController {
    private final CsTenderService csTenderService;

    public CsTenderController(CsTenderService csTenderService) {
        this.csTenderService = csTenderService;
    }

    /**
     * 获取招标项目详细信息
     */
    @GetMapping("/{sid}")
    public AjaxResult getCsTenderBySid(@PathVariable("sid") Integer sid) {
        return AjaxResult.success(csTenderService.getCsTenderBySid(sid));
    }

    /**
     * 修改招标项目
     */
    @PutMapping
    public AjaxResult edit(@RequestBody CsTender csTender) {
        return toAjax(csTenderService.updateCsTender(csTender));
    }

    /**
     * 获取没有合同的项目
     */
    @GetMapping("/NoEidTenderList")
    public TableDataInfo noContract(CsTender csTender) {
        System.out.println(csTender.toString());
        startPage();
        List<CsTender> list = csTenderService.listNoEidTender(csTender);
        return getDataTable(list);
    }
}
